package day5;

import java.util.Arrays;
import java.util.Scanner;

public class demo4 {
    public static void main(String[] args) {
        //有一个有序的元素 手动 插入一个元素还有序
        int[] nums = {1,2,3,4,5,6,7,8,9};
        System.out.println(Arrays.toString(nums));
        Scanner sc = new Scanner(System.in);
        int number=sc.nextInt();
        int i;
        int[] newnums = new int[nums.length+1];
        for (i = 0; i < nums.length; i++){
            newnums[i]=nums[i];
            if(number<nums[i]){
                newnums[i]=number;
                break;
            }

        }
        System.out.println(Arrays.toString(newnums));
    }
}
